<?php


namespace App\Extensions\Exporters;


use Encore\Admin\Grid;
use Encore\Admin\Grid\Exporters\ExcelExporter;
use Maatwebsite\Excel\Concerns\WithMapping;

class PatentEstimateExporter extends ExcelExporter implements WithMapping
{
    protected $fileName = '专利分级分类.xlsx';

    protected $columns = [
        'patent_sn' => '专利号',
        'patent_name' => '专利名称',
        'patent_type_id' => '专利类型',
        'legal_status' => '法律状态',
        'apply_date' => '申请日',
        'score' => '价值评估',
    ];

    public function __construct(Grid $grid = null)
    {
        parent::__construct($grid);
    }

    public function map($row): array
    {
        return [
            $row->patent_sn . "\t",
            $row->patent_name,
            $row->type->name??'',
            $row->legal_status,
            $row->apply_date . "\t",
            $row->score,
        ];
    }


}
